/******** home.js start ******/
$(function() {
    var tap = "ontouchstart" in document ? "touchend" : "click";
    // PC端轮播
    var homeSwiper = new Swiper(".home-banner", {
        // loop: true,
        speed: 500,
        watchOverflow: true,
        slidesPerView: 1,
        // disableOnInteraction: true,
        autoplay: {
            delay: 5000,
            stopOnLastSlide: false,
            // disableOnInteraction: true,
        },
        observer: true,
        observeParents: true,
        navigation: {
            nextEl: ".home-btn-next",
            prevEl: ".home-btn-prev",
        },
        pagination: {
            el: ".home-btn",
            clickable: true,
        },

        on: {
            init: function() {
                $('.home-banner .swiper-slide').eq(0).find('.hmweb-paging').addClass('scaleUpDown')
            },
            slideChangeTransitionEnd: function() {
                var $slide = $(this.slides[this.activeIndex]);
                $slide.find('.hmweb-paging').addClass('scaleUpDown')
                    .end()
                    .siblings().find('.hmweb-paging').removeClass('scaleUpDown');
            },
        }
    });

    if (homeSwiper.slides.length <= 1) {
        $(".home-btn").hide();
        $(".home-btn-next").hide();
        $(".home-btn-prev").hide();
        $(".home-banWeb").addClass("swiper-no-swiping");
    }

    // 投资建设与服务
    $('.home4-tit-list .item').mouseover(function() {
        $(this).addClass('active').siblings().removeClass('active')
        $('.home4-item-list .item-item').eq($(this).index()).css('display', 'block').animate({
            'opacity': '1',
            'display': 'block'
        }).siblings().css({
            'opacity': '0',
            'display': 'none'
        })
    })

    if ($(".home1-swiper .swiper-slide").length > 0) {
        // 重点新闻
        var home1Swiper = new Swiper(".home1-swiper", {
            // loop: true,
            speed: 500,
            watchOverflow: true,
            spaceBetween: 30,
            disableOnInteraction: true,
            autoplay: {
                delay: 5000,
                stopOnLastSlide: false,
                disableOnInteraction: true,
            },
            breakpoints: {
                0: {
                    pagination: {
                        el: ".home1-btn",
                        clickable: true,
                        type: 'bullets',
                    },
                },
                992: {
                    pagination: {
                        el: ".home1-btn",
                        clickable: true,
                        type: 'fraction',
                    },
                },
            },
            observer: true,
            observeParents: true,
            navigation: {
                nextEl: ".home1-btn-next",
                prevEl: ".home1-btn-prev",
            },

        });

        if (home1Swiper.slides.length <= 1) {
            $(".home1-btn").hide();
            $(".home1-btn-prev").hide();
            $(".home1-btn-next").hide();
            $(".home-banWeb").addClass("swiper-no-swiping");
        }
    }




});